package com.lesson03;

import javax.swing.*;
import java.awt.*;

public class JFrameDemo02 {
    public static void main(String[] args) {
        new MyJFrame2().init();
    }
}
class MyJFrame2 extends JFrame {
    public void init()
    {
        setBounds(100,100,600,400);
        setVisible(true);
        JLabel label = new JLabel("这是一个JFrame窗口");
        add(label);
        //文本剧中
        label.setHorizontalAlignment(SwingConstants.CENTER);
        //获得容器
        Container container = this.getContentPane();
        container.setBackground(Color.blue);
    }

}